import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * httpServletResponse练习
 */
public class S20_HttpServletResponseExercise extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        req.setCharacterEncoding("UTF-8");
        double money = Double.parseDouble(req.getParameter("money"));
        if (money > 100) {
            resp.sendRedirect("/servlet/homework3.html");
        } else {
            resp.sendRedirect("/servlet/homework2.html");
        }
    }
}
